package v1

import (
	"devops-super/api"
	"devops-super/internal/model/entity"
	"github.com/gogf/gf/v2/frame/g"
)

// DeptConfigGetPageLstReq 分页获取部门配置列表请求
type DeptConfigGetPageLstReq struct {
	g.Meta `method:"get" path:"/dept-config/page-list" summary:"分页获取部门配置列表" tags:"部门配置"`
	*api.PageLstReq
}

// DeptConfigGetPageLstRes 分页获取部门配置列表响应
type DeptConfigGetPageLstRes struct {
	*api.PageLstRes[*entity.DeptConfig]
}

// DeptConfigAddReq 添加部门配置请求
type DeptConfigAddReq struct {
	g.Meta       `method:"post" path:"/dept-config" summary:"添加部门配置" tags:"部门配置"`
	DeptId       uint64  `v:"required#部门ID不能为空" json:"deptId"`
	GroupName    string  `v:"required#配置组名不能为空" json:"groupName"`
	ConfigKey    string  `v:"required#配置键不能为空" json:"configKey"`
	ConfigValue  string  `v:"required#配置值不能为空" json:"configValue"`
	Remark       string  `json:"remark"`
	Range        int     `json:"range"`
}

// DeptConfigAddRes 添加部门配置响应
type DeptConfigAddRes struct {
	Id uint64 `json:"id"`
}

// DeptConfigUptReq 更新部门配置请求
type DeptConfigUptReq struct {
	g.Meta       `method:"put" path:"/dept-config/{id}" summary:"更新部门配置" tags:"部门配置"`
	Id           uint64  `v:"required#ID不能为空" json:"id" path:"id"`
	DeptId       uint64  `v:"required#部门ID不能为空" json:"deptId"`
	GroupName    string  `v:"required#配置组名不能为空" json:"groupName"`
	ConfigKey    string  `v:"required#配置键不能为空" json:"configKey"`
	ConfigValue  string  `v:"required#配置值不能为空" json:"configValue"`
	Remark       string  `json:"remark"`
	Range        int     `json:"range"`
}

// DeptConfigUptRes 更新部门配置响应
type DeptConfigUptRes struct {}

// DeptConfigDelReq 删除部门配置请求
type DeptConfigDelReq struct {
	g.Meta `method:"delete" path:"/dept-config/{id}" summary:"删除部门配置" tags:"部门配置"`
	Id     uint64 `v:"required#ID不能为空" json:"id" path:"id"`
}

// DeptConfigDelRes 删除部门配置响应
type DeptConfigDelRes struct {}

// DeptConfigGetOneReq 获取单个部门配置请求
type DeptConfigGetOneReq struct {
	g.Meta `method:"get" path:"/dept-config/{id}" summary:"获取单个部门配置" tags:"部门配置"`
	Id     uint64 `v:"required#ID不能为空" json:"id" path:"id"`
}

// DeptConfigGetOneRes 获取单个部门配置响应
type DeptConfigGetOneRes struct {
	Info *entity.DeptConfig `json:"info"`
}

// DeptConfigGetByDeptReq 按部门获取配置请求
type DeptConfigGetByDeptReq struct {
	g.Meta   `method:"get" path:"/dept-config/by-dept" summary:"按部门获取配置" tags:"部门配置"`
	DeptId   uint64 `v:"required#部门ID不能为空" json:"deptId"`
	GroupName string `json:"groupName"`
}

// DeptConfigGetByDeptRes 按部门获取配置响应
type DeptConfigGetByDeptRes struct {
	Configs []*entity.DeptConfig `json:"configs"`
}

// GetDeptGroupConfigsReq 获取部门配置组请求
type GetDeptGroupConfigsReq struct {
	g.Meta    `method:"get" path:"/dept-config/getGroupConfigs" summary:"获取部门配置组" tags:"部门配置"`
	DeptId    uint64 `v:"min:1#部门ID必须" json:"deptId" in:"query"`
	GroupName string `v:"required#配置组名必须" json:"groupName" in:"query"`
}

// GetDeptGroupConfigsRes 获取部门配置组响应
type GetDeptGroupConfigsRes struct {
	Configs   []*entity.DeptConfig `json:"configs"`
	UpdatedAt string               `json:"updatedAt"`
}

// SetDeptGroupConfigsReq 保存部门配置组请求
type SetDeptGroupConfigsReq struct {
	g.Meta    `method:"post" path:"/dept-config/setGroupConfigs" summary:"保存部门配置组" tags:"部门配置"`
	DeptId    uint64 `v:"min:1#部门ID必须" json:"deptId"`
	GroupName string `v:"required#配置组名必须" json:"groupName"`
	Configs   []struct {
		ConfigKey   string `v:"required#配置键必须" json:"configKey"`
		ConfigValue string `v:"required#配置值必须" json:"configValue"`
		ConfigDesc  string `json:"configDesc"`
	} `v:"required#配置项不能为空" json:"configs"`
}

// SetDeptGroupConfigsRes 保存部门配置组响应
type SetDeptGroupConfigsRes struct {}